import logging

from config import URL


class OpenAccountApi(object):
    def __init__(self, session):
        self.session = session

    def realname(self, realname_v, cardId_v):
        url = URL + "/member/realname/approverealname"
        form_data = {'realname': realname_v, 'card_id': cardId_v}
        response = self.session.post(url=url, data=form_data, files={"x": "y"})
        logging.info("实名认证接口返回的响应结果:{}".format(response.json()))
        return response

    def open_account(self):
        url = URL + "/trust/trust/register"
        response = self.session.post(url=url)
        logging.info("开户接口返回的响应结果:{}".format(response.json()))
        return response

    def third_open_account(self, url, form_data):
        response = self.session.post(url=url, data=form_data)
        logging.info("第三方开户接口返回的响应结果:{}".format(response.text))
        return response
